import { createWebHistory, createRouter } from 'vue-router'

import Home from '../view/layout/home/index.vue'
import Register from '../view/register/index.vue'
import Layout from '../view/layout/index.vue'
import User from '../view/layout/user/index.vue'
import Login from '../view/login/index.vue'

export const constantRouters = [
    {
        path: '/',
        component: Layout,
        redirect: '/home',
        children: [
            {
                path: 'home',
                component: Home
            },
            {
                path: 'user',
                component: User
            }
        ]
    },
    {
        path: '/register',
        component: Register
    },
    {
        path: '/login',
        component: Login
    }
]

const router = createRouter({
    history: createWebHistory(),
    routes: [...constantRouters]
})

export default router
